package com.ruoyi.project.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.project.domain.YqgRowNumber;
import com.ruoyi.project.service.IYqgRowNumberService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 搓澡排号Controller
 * 
 * @author ruoyi
 * @date 2023-04-17
 */
@RestController
@RequestMapping("/number")
public class YqgRowNumberController extends BaseController
{
    @Autowired
    private IYqgRowNumberService yqgRowNumberService;

    /**
     * 查询搓澡排号列表
     */
    @RequiresPermissions("project:number:list")
    @GetMapping("/list")
    public TableDataInfo list(YqgRowNumber yqgRowNumber)
    {
        startPage();
        List<YqgRowNumber> list = yqgRowNumberService.selectYqgRowNumberList(yqgRowNumber);
        return getDataTable(list);
    }

    /**
     * 导出搓澡排号列表
     */
    @RequiresPermissions("project:number:export")
    @Log(title = "搓澡排号", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, YqgRowNumber yqgRowNumber)
    {
        List<YqgRowNumber> list = yqgRowNumberService.selectYqgRowNumberList(yqgRowNumber);
        ExcelUtil<YqgRowNumber> util = new ExcelUtil<YqgRowNumber>(YqgRowNumber.class);
        util.exportExcel(response, list, "搓澡排号数据");
    }

    /**
     * 获取搓澡排号详细信息
     */
    @RequiresPermissions("project:number:query")
    @GetMapping(value = "/{ID}")
    public AjaxResult getInfo(@PathVariable("ID") Long ID)
    {
        return success(yqgRowNumberService.selectYqgRowNumberByID(ID));
    }

    /**
     * 新增搓澡排号
     */
    @RequiresPermissions("project:number:add")
    @Log(title = "搓澡排号", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody YqgRowNumber yqgRowNumber)
    {
        return toAjax(yqgRowNumberService.insertYqgRowNumber(yqgRowNumber));
    }

    /**
     * 修改搓澡排号
     */
    @RequiresPermissions("project:number:edit")
    @Log(title = "搓澡排号", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody YqgRowNumber yqgRowNumber)
    {
        return toAjax(yqgRowNumberService.updateYqgRowNumber(yqgRowNumber));
    }

    /**
     * 删除搓澡排号
     */
    @RequiresPermissions("project:number:remove")
    @Log(title = "搓澡排号", businessType = BusinessType.DELETE)
	@DeleteMapping("/{IDs}")
    public AjaxResult remove(@PathVariable Long[] IDs)
    {
        return toAjax(yqgRowNumberService.deleteYqgRowNumberByIDs(IDs));
    }
}
